.class public Lcom/estrongs/android/pop/bt/a;
.super Ljava/lang/Object;
.source "OBEXFtpServer.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/estrongs/android/pop/bt/a$b;
    }
.end annotation


# static fields
.field public static final h:Ljava/util/UUID;

.field private static final i:[B


# instance fields
.field private a:Lcom/estrongs/bluetooth/parser/a;

.field private b:Les/xp0;

.field private c:Z

.field private d:Z

.field private e:Landroid/content/Context;

.field private final f:Ljava/lang/String;

.field private g:Lcom/estrongs/android/pop/bt/b;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    const-string v0, "00001106-0000-1000-8000-00805F9B34FB"

    .line 1
    invoke-static {v0}, Ljava/util/UUID;->fromString(Ljava/lang/String;)Ljava/util/UUID;

    move-result-object v0

    sput-object v0, Lcom/estrongs/android/pop/bt/a;->h:Ljava/util/UUID;

    const/16 v0, 0x10

    new-array v0, v0, [B

    .line 2
    fill-array-data v0, :array_0

    sput-object v0, Lcom/estrongs/android/pop/bt/a;->i:[B

    return-void

    :array_0
    .array-data 1
        -0x7t
        -0x14t
        0x7bt
        -0x3ct
        -0x6bt
        0x3ct
        0x11t
        -0x2et
        -0x68t
        0x4et
        0x52t
        0x54t
        0x0t
        -0x24t
        -0x62t
        0x9t
    .end array-data
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 2
    iput-boolean v0, p0, Lcom/estrongs/android/pop/bt/a;->c:Z

    .line 3
    iput-boolean v0, p0, Lcom/estrongs/android/pop/bt/a;->d:Z

    .line 4
    new-instance v0, Lcom/estrongs/android/pop/bt/a$a;

    invoke-direct {v0, p0}, Lcom/estrongs/android/pop/bt/a$a;-><init>(Lcom/estrongs/android/pop/bt/a;)V

    iput-object v0, p0, Lcom/estrongs/android/pop/bt/a;->g:Lcom/estrongs/android/pop/bt/b;

    .line 5
    new-instance v0, Lcom/estrongs/bluetooth/parser/a;

    invoke-direct {v0}, Lcom/estrongs/bluetooth/parser/a;-><init>()V

    iput-object v0, p0, Lcom/estrongs/android/pop/bt/a;->a:Lcom/estrongs/bluetooth/parser/a;

    .line 6
    iput-object p1, p0, Lcom/estrongs/android/pop/bt/a;->e:Landroid/content/Context;

    .line 7
    invoke-static {}, Lcom/estrongs/android/pop/l;->L1()Lcom/estrongs/android/pop/l;

    move-result-object p1

    .line 8
    invoke-virtual {p1}, Lcom/estrongs/android/pop/l;->s()Ljava/lang/String;

    move-result-object p1

    iput-object p1, p0, Lcom/estrongs/android/pop/bt/a;->f:Ljava/lang/String;

    return-void
.end method

.method static synthetic a(Lcom/estrongs/android/pop/bt/a;Ljava/lang/String;Ljava/lang/String;)Ljava/util/ArrayList;
    .locals 0

    .line 3
    invoke-direct {p0, p1, p2}, Lcom/estrongs/android/pop/bt/a;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/util/ArrayList;

    move-result-object p0

    return-object p0
.end method

.method private a(Ljava/lang/String;Ljava/lang/String;)Ljava/util/ArrayList;
    .locals 6
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ")",
            "Ljava/util/ArrayList<",
            "Lcom/estrongs/bluetooth/parser/OBEXElement;",
            ">;"
        }
    .end annotation

    .line 24
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    if-eqz p2, :cond_0

    .line 25
    invoke-virtual {p2}, Ljava/lang/String;->length()I

    move-result v1

    if-lez v1, :cond_0

    .line 26
    new-instance v1, Ljava/io/File;

    invoke-direct {v1, p1, p2}, Ljava/io/File;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 27
    :cond_0
    new-instance v1, Ljava/io/File;

    invoke-direct {v1, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 28
    :goto_0
    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result p1

    if-eqz p1, :cond_5

    invoke-virtual {v1}, Ljava/io/File;->isDirectory()Z

    move-result p1

    if-nez p1, :cond_1

    goto :goto_4

    .line 29
    :cond_1
    invoke-virtual {v1}, Ljava/io/File;->listFiles()[Ljava/io/File;

    move-result-object p1

    .line 30
    array-length p2, p1

    const/4 v1, 0x0

    :goto_1
    if-ge v1, p2, :cond_4

    aget-object v2, p1, v1

    if-nez v2, :cond_2

    goto :goto_3

    .line 31
    :cond_2
    new-instance v3, Lcom/estrongs/bluetooth/parser/OBEXElement;

    invoke-direct {v3}, Lcom/estrongs/bluetooth/parser/OBEXElement;-><init>()V

    .line 32
    invoke-virtual {v2}, Ljava/io/File;->getName()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Lcom/estrongs/bluetooth/parser/OBEXElement;->b(Ljava/lang/String;)V

    .line 33
    invoke-virtual {v2}, Ljava/io/File;->isDirectory()Z

    move-result v4

    if-eqz v4, :cond_3

    sget-object v4, Lcom/estrongs/bluetooth/parser/OBEXElement$OBEXElementType;->FOLDER:Lcom/estrongs/bluetooth/parser/OBEXElement$OBEXElementType;

    goto :goto_2

    :cond_3
    sget-object v4, Lcom/estrongs/bluetooth/parser/OBEXElement$OBEXElementType;->FILE:Lcom/estrongs/bluetooth/parser/OBEXElement$OBEXElementType;

    :goto_2
    invoke-virtual {v3, v4}, Lcom/estrongs/bluetooth/parser/OBEXElement;->a(Lcom/estrongs/bluetooth/parser/OBEXElement$OBEXElementType;)V

    .line 34
    invoke-virtual {v2}, Ljava/io/File;->length()J

    move-result-wide v4

    invoke-virtual {v3, v4, v5}, Lcom/estrongs/bluetooth/parser/OBEXElement;->b(J)V

    .line 35
    invoke-virtual {v2}, Ljava/io/File;->lastModified()J

    move-result-wide v4

    invoke-virtual {v3, v4, v5}, Lcom/estrongs/bluetooth/parser/OBEXElement;->a(J)V

    .line 36
    invoke-virtual {v0, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    :goto_3
    add-int/lit8 v1, v1, 0x1

    goto :goto_1

    :cond_4
    return-object v0

    :cond_5
    :goto_4
    const/4 p1, 0x0

    return-object p1
.end method

.method static synthetic a(Lcom/estrongs/android/pop/bt/a;Ljava/lang/String;)V
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Lcom/estrongs/android/pop/bt/a;->e(Ljava/lang/String;)V

    return-void
.end method

.method static synthetic a(Lcom/estrongs/android/pop/bt/a;)Z
    .locals 0

    .line 2
    iget-boolean p0, p0, Lcom/estrongs/android/pop/bt/a;->c:Z

    return p0
.end method

.method static synthetic a(Lcom/estrongs/android/pop/bt/a;[B)Z
    .locals 0

    .line 4
    invoke-direct {p0, p1}, Lcom/estrongs/android/pop/bt/a;->a([B)Z

    move-result p0

    return p0
.end method

.method private a(Ljava/lang/String;)Z
    .locals 5

    .line 13
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 14
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result p1

    const/4 v1, 0x0

    if-nez p1, :cond_0

    return v1

    .line 15
    :cond_0
    invoke-virtual {v0}, Ljava/io/File;->isDirectory()Z

    move-result p1

    if-eqz p1, :cond_3

    .line 16
    invoke-virtual {v0}, Ljava/io/File;->listFiles()[Ljava/io/File;

    move-result-object p1

    if-eqz p1, :cond_2

    .line 17
    array-length v2, p1

    const/4 v3, 0x0

    :goto_0
    if-ge v3, v2, :cond_2

    aget-object v4, p1, v3

    .line 18
    invoke-virtual {v4}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v4

    invoke-direct {p0, v4}, Lcom/estrongs/android/pop/bt/a;->a(Ljava/lang/String;)Z

    move-result v4

    if-nez v4, :cond_1

    return v1

    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 19
    :cond_2
    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    move-result p1

    goto :goto_1

    .line 20
    :cond_3
    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    move-result p1

    :goto_1
    return p1
.end method

.method private a([B)Z
    .locals 4

    const/4 v0, 0x0

    if-eqz p1, :cond_3

    .line 21
    array-length v1, p1

    sget-object v2, Lcom/estrongs/android/pop/bt/a;->i:[B

    array-length v2, v2

    if-eq v1, v2, :cond_0

    goto :goto_1

    :cond_0
    const/4 v1, 0x0

    .line 22
    :goto_0
    sget-object v2, Lcom/estrongs/android/pop/bt/a;->i:[B

    array-length v3, v2

    if-ge v1, v3, :cond_2

    .line 23
    aget-byte v2, v2, v1

    aget-byte v3, p1, v1

    if-eq v2, v3, :cond_1

    return v0

    :cond_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_2
    const/4 p1, 0x1

    return p1

    :cond_3
    :goto_1
    return v0
.end method

.method static synthetic b(Lcom/estrongs/android/pop/bt/a;)Lcom/estrongs/bluetooth/parser/a;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/android/pop/bt/a;->a:Lcom/estrongs/bluetooth/parser/a;

    return-object p0
.end method

.method static synthetic b(Lcom/estrongs/android/pop/bt/a;Ljava/lang/String;)Ljava/lang/String;
    .locals 0

    .line 2
    invoke-direct {p0, p1}, Lcom/estrongs/android/pop/bt/a;->c(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p0

    return-object p0
.end method

.method private b(Ljava/lang/String;)Z
    .locals 1

    .line 4
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result p1

    return p1
.end method

.method static synthetic c(Lcom/estrongs/android/pop/bt/a;)Ljava/lang/String;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/estrongs/android/pop/bt/a;->f:Ljava/lang/String;

    return-object p0
.end method

.method private c(Ljava/lang/String;)Ljava/lang/String;
    .locals 1

    .line 31
    invoke-static {p1}, Lcom/estrongs/android/util/h0;->M(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    .line 32
    iget-object v0, p0, Lcom/estrongs/android/pop/bt/a;->f:Ljava/lang/String;

    invoke-virtual {p1, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 33
    iget-object p1, p0, Lcom/estrongs/android/pop/bt/a;->f:Ljava/lang/String;

    :cond_0
    return-object p1
.end method

.method static synthetic c(Lcom/estrongs/android/pop/bt/a;Ljava/lang/String;)Z
    .locals 0

    .line 2
    invoke-direct {p0, p1}, Lcom/estrongs/android/pop/bt/a;->b(Ljava/lang/String;)Z

    move-result p0

    return p0
.end method

.method static synthetic d(Lcom/estrongs/android/pop/bt/a;)Lcom/estrongs/android/pop/bt/b;
    .locals 0

    .line 3
    iget-object p0, p0, Lcom/estrongs/android/pop/bt/a;->g:Lcom/estrongs/android/pop/bt/b;

    return-object p0
.end method

.method static synthetic d(Lcom/estrongs/android/pop/bt/a;Ljava/lang/String;)Z
    .locals 0

    .line 2
    invoke-direct {p0, p1}, Lcom/estrongs/android/pop/bt/a;->d(Ljava/lang/String;)Z

    move-result p0

    return p0
.end method

.method private d(Ljava/lang/String;)Z
    .locals 1

    .line 4
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->mkdirs()Z

    move-result p1

    return p1
.end method

.method static synthetic d()[B
    .locals 1

    .line 1
    sget-object v0, Lcom/estrongs/android/pop/bt/a;->i:[B

    return-object v0
.end method

.method private e(Ljava/lang/String;)V
    .locals 1

    .line 3
    iget-object v0, p0, Lcom/estrongs/android/pop/bt/a;->g:Lcom/estrongs/android/pop/bt/b;

    invoke-interface {v0, p1}, Lcom/estrongs/android/pop/bt/b;->a(Ljava/lang/String;)V

    return-void
.end method

.method private e()Z
    .locals 3

    const/4 v0, 0x0

    .line 2
    :try_start_0
    sget-object v1, Landroid/os/Build$VERSION;->SDK:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v1
    :try_end_0
    .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0

    const/4 v2, 0x5

    if-lt v1, v2, :cond_0

    const/4 v0, 0x1

    :catch_0
    :cond_0
    return v0
.end method

.method static synthetic e(Lcom/estrongs/android/pop/bt/a;Ljava/lang/String;)Z
    .locals 0

    .line 1
    invoke-direct {p0, p1}, Lcom/estrongs/android/pop/bt/a;->a(Ljava/lang/String;)Z

    move-result p0

    return p0
.end method


# virtual methods
.method public a()V
    .locals 3

    const-string v0, "OBEXFtpServer"

    const-string v1, "xxxxxxxxxx"

    const-string v2, "close"

    .line 5
    invoke-static {v1, v2}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;)V

    const/4 v1, 0x1

    .line 6
    iput-boolean v1, p0, Lcom/estrongs/android/pop/bt/a;->c:Z

    .line 7
    :try_start_0
    iget-object v1, p0, Lcom/estrongs/android/pop/bt/a;->b:Les/xp0;

    if-eqz v1, :cond_0

    .line 8
    iget-object v1, p0, Lcom/estrongs/android/pop/bt/a;->b:Les/xp0;

    invoke-interface {v1}, Les/lp0;->close()V

    .line 9
    invoke-direct {p0}, Lcom/estrongs/android/pop/bt/a;->e()Z

    :cond_0
    const/4 v1, 0x0

    .line 10
    iput-boolean v1, p0, Lcom/estrongs/android/pop/bt/a;->d:Z

    const-string v1, "OBEX ServerConnection closed"

    .line 11
    invoke-static {v0, v1}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v1

    const-string v2, "OBEX Server stop error"

    .line 12
    invoke-static {v0, v2, v1}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    :goto_0
    return-void
.end method

.method public b()Z
    .locals 1

    .line 3
    iget-boolean v0, p0, Lcom/estrongs/android/pop/bt/a;->d:Z

    return v0
.end method

.method public c()V
    .locals 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const-string v0, "OBEX Server finished!"

    const-string v1, "OBEXFtpServer"

    const/4 v2, 0x0

    .line 3
    iput-boolean v2, p0, Lcom/estrongs/android/pop/bt/a;->c:Z

    .line 4
    :try_start_0
    invoke-direct {p0}, Lcom/estrongs/android/pop/bt/a;->e()Z

    move-result v3

    if-eqz v3, :cond_0

    const-string v3, "FTP"

    .line 5
    sget-object v4, Lcom/estrongs/android/pop/bt/a;->h:Ljava/util/UUID;

    invoke-static {v3, v4}, Les/c10;->a(Ljava/lang/String;Ljava/util/UUID;)Les/xp0;

    move-result-object v3

    iput-object v3, p0, Lcom/estrongs/android/pop/bt/a;->b:Les/xp0;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1

    :cond_0
    const/4 v3, 0x1

    .line 6
    :try_start_1
    iput-boolean v3, p0, Lcom/estrongs/android/pop/bt/a;->d:Z

    const/4 v4, 0x0

    :goto_0
    const/4 v5, 0x0

    .line 7
    :goto_1
    iget-boolean v6, p0, Lcom/estrongs/android/pop/bt/a;->c:Z

    if-nez v6, :cond_4

    .line 8
    new-instance v6, Lcom/estrongs/android/pop/bt/a$b;

    const/4 v7, 0x0

    invoke-direct {v6, p0, v7}, Lcom/estrongs/android/pop/bt/a$b;-><init>(Lcom/estrongs/android/pop/bt/a;Lcom/estrongs/android/pop/bt/a$a;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_1

    add-int/2addr v4, v3

    :try_start_2
    const-string v7, "Accepting OBEX ftp connections"

    .line 9
    invoke-static {v1, v7}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 10
    iget-object v7, p0, Lcom/estrongs/android/pop/bt/a;->b:Les/xp0;

    .line 11
    invoke-interface {v7, v6}, Les/xp0;->a(Les/wp0;)Les/lp0;

    move-result-object v7

    .line 12
    invoke-virtual {v6, v7, v4}, Lcom/estrongs/android/pop/bt/a$b;->a(Les/lp0;I)V
    :try_end_2
    .catch Ljava/io/InterruptedIOException; {:try_start_2 .. :try_end_2} :catch_0
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v6

    :try_start_3
    const-string v7, "Stack closed"

    .line 13
    invoke-virtual {v6}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_1

    .line 14
    iput-boolean v3, p0, Lcom/estrongs/android/pop/bt/a;->c:Z

    .line 15
    :cond_1
    iget-boolean v7, p0, Lcom/estrongs/android/pop/bt/a;->c:Z
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_1

    if-eqz v7, :cond_2

    .line 16
    :goto_2
    invoke-virtual {p0}, Lcom/estrongs/android/pop/bt/a;->a()V

    .line 17
    invoke-static {v1, v0}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 18
    iput-boolean v2, p0, Lcom/estrongs/android/pop/bt/a;->d:Z

    return-void

    :cond_2
    add-int/2addr v5, v3

    const/16 v7, 0x1e

    if-ne v5, v7, :cond_3

    .line 19
    :try_start_4
    invoke-static {}, Les/yt;->m()Les/yt;

    move-result-object v3

    invoke-virtual {v3}, Les/yt;->c()V

    goto :goto_2

    :cond_3
    const-string v7, "acceptAndOpen "

    .line 20
    invoke-static {v1, v7, v6}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_1

    .line 21
    :catch_0
    iput-boolean v3, p0, Lcom/estrongs/android/pop/bt/a;->c:Z
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_1

    .line 22
    :cond_4
    invoke-virtual {p0}, Lcom/estrongs/android/pop/bt/a;->a()V

    .line 23
    invoke-static {v1, v0}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 24
    iput-boolean v2, p0, Lcom/estrongs/android/pop/bt/a;->d:Z

    return-void

    :catchall_1
    move-exception v3

    .line 25
    invoke-virtual {p0}, Lcom/estrongs/android/pop/bt/a;->a()V

    .line 26
    invoke-static {v1, v0}, Lcom/estrongs/android/util/n;->a(Ljava/lang/String;Ljava/lang/String;)V

    .line 27
    iput-boolean v2, p0, Lcom/estrongs/android/pop/bt/a;->d:Z

    .line 28
    throw v3

    :catch_1
    move-exception v0

    const-string v2, "Unable to create notifier"

    .line 29
    invoke-static {v1, v2}, Lcom/estrongs/android/util/n;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 30
    goto :goto_4

    :goto_3
    throw v0

    :goto_4
    goto :goto_3
.end method
